filename = "out.txt"

with open(filename, "w") as file:
    while True:
        char = input("请输入一个字符（输入*结束）: ")
        if char == "*":
            break
        file.write(char)

print("输入已保存到文件", filename)
